package com.project.managementpaltform.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ProjectMapper {

    /**
     * 根据项目名称去查项目负责人
     * @param EntryName 项目名称
     * */
    @Select("SELECT Project leader FROM project WHERE Entry name = #{EntryName} AND ROWNUM=1")
    String queryProjectLeaderByEntryName(@Param("Entry name") String EntryName);

    /**
     * 根据项目负责人去查项目名称
     * @param ProjectLeader 项目负责人
     * */
    @Select("SELECT Entry name  FROM project WHERE Project leader = #{ProjectLeader} AND ROWNUM=1")
    String queryEntryNameByProjectLeader(@Param("Project leader") String ProjectLeader);
    /**
     * 插入新项目
     *
     * */
    @Insert("INERT INTO project (Entry name,Project leader)" +
            " VALUES(#{EntryName},#{ProjectLeader})")
    int insertProject(@Param("Entry name") String EntryName,
                    @Param("Project leader") String ProjectLeader);

}
